package com.newcoin.chat.dao;

import com.newcoin.chat.beans.entity.CircleOfFriendComment;
import com.newcoin.chat.beans.entity.CircleOfFriendLikeEntity;
import com.newcoin.chat.beans.entity.CircleOfFriendSeeEntity;
import com.newcoin.chat.beans.entity.CircleOfFriendsEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

@Component
public interface CircleOfFriendsDao {

    /**
     * 发布朋友圈
     *
     * @param circleOfFriendsEntity
     * @return
     */
    int addCircleOfFriends(CircleOfFriendsEntity circleOfFriendsEntity);

    /**
     * 添加可见与不可见
     *
     * @param circleOfFriendSeeEntity
     * @return
     */
    @Insert("INSERT INTO circle_of_friend_see (circle_friends_id,see_or_not_see_user_id,state) VALUES (#{circleFriendsId},#{seeOrNotSeeUserId},#{state})")
    int addCircleOfFriendSee(CircleOfFriendSeeEntity circleOfFriendSeeEntity);

    /**
     * 删除朋友圈
     *
     * @param userId
     * @param circleFriendsId
     * @return
     */
    @Update("UPDATE circle_of_friends SET state=1 WHERE user_id=#{userId} AND id=#{circleFriendsId}")
    int deleteCircleOfFriends(@Param("userId") long userId, @Param("circleFriendsId") long circleFriendsId);

    /**
     * 点赞
     *
     * @return
     */
    @Insert("INSERT INTO circle_of_friend_like(circle_friends_id,user_id) VALUES (#{userId},#{circleFriendsId})")
    int addCircleOfFriendLike(CircleOfFriendLikeEntity circleOfFriendLikeEntity);

    /**
     * 评论
     * @param circleOfFriendComment
     * @return
     */
    @Insert("INSERT INTO circle_of_friend_comment (circle_friends_id,user_id,context) VALUES (#{circleFriendsId},#{userId},#{context})")
    int addCircleOfFriendComment(CircleOfFriendComment circleOfFriendComment);
}
